Skip to content

Check the offset when loading the old marshal format - #205

Merged
nobu merged 2 commits into
ruby:masterfrom
wtn:dangling
Nov 16, 2026
Merged

nobu merged 2 commits into
ruby:masterfrom
wtn:dangling

Conversation

@wtn

@wtn wtn commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Since 3e73333, the if that checks the second fraction in old_to_new is missing its rb_raise, so the offset check below it doesn't run. A three-element dump with a 5-day offset loads as +120:00:

d = DateTime.allocate
d.marshal_load([Rational(0), 5, Date::ITALY])
d.offset # => (5/1)
d.zone   # => "+120:00"

The second fraction check now raises Date::Error. The example now loads with offset 0 and warns "invalid offset is ignored" under -w.

wtn and others added 2 commits November 13, 2026 23:01
The if that checks the second fraction in old_to_new was missing its
rb_raise, so the offset check below it didn't run. An old-format dump
with a 5-day offset loaded as +120:00.

Co-authored-by: Claude Mythos 5.2 <noreply@anthropic.com>
@nobu
nobu merged commit d27c473 into ruby:master Nov 16, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants